package lab01;

import java.util.Scanner;

/**
 * Created by dell on 2017/10/9.
 */
public class Test12 {
    public static void main(String[] args) {
int a1,a2,a3,a4,num;
num=0;
        System.out.println("输入一个数：");
        Scanner input=new Scanner(System.in);
        num=input.nextInt();
        if(num>=1&&num<=10000){
            a1=num/1000;//千位
            a2=(num%1000)/100;//百位
            a3=(num%100)/10;//十位
            a4=num%10;
            if(a1!=0){
                System.out.println(num+"是四位数");
                if(a1==a4&&a2==a3){
                    System.out.println(num+"是回文");
                }
                else{
                    System.out.println(num+"不是回文");
                }
            }
            else if(a2!=0){
                System.out.println(num+"是三位数");
                if(a2==a4){
                    System.out.println(num+"是回文");
                }
                else{
                    System.out.println(num+"不是回文");
                }
            }else if(a3!=0){
            System.out.println(num+"是2位数");
            if(a3==a4){
                System.out.println(num+"是回文");
            }
            else{
                System.out.println(num+"不是回文");
            }
        }
        else{
            System.out.println(num+"是1位");
            System.out.println(num+"是回文");
        }
    }else
        {
        System.out.println("该数不在1—9999之间，请重新输入！！！");
        }
    }
}
